package intermediate_representation;

public class ExpRP extends InterRP {
    private String op1;
    private String op2;
    private String op;
    private String result;

    public ExpRP(String op1, String op2, String op, String result) {
        this.op1 = op1;
        this.op2 = op2;
        this.op = op;
        this.result = result;
    }

    public ExpRP(String op1, String op, String result) {
        this.op1 = op1;
        this.op = op;
        this.result = result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getOp1() {
        return op1;
    }

    public String getOp2() {
        return op2;
    }

    public String getOp() {
        return op;
    }

    public String getResult() {
        return result;
    }

    public String toString() {
        if (op2 != null) {
            return result + " = " + op1 + " " + op + " " + op2;
        } else {
            return result + " = " + op + " " + op1;
        }
    }
}
